package  
{
	import flash.display.Sprite;
	import flash.utils.Dictionary;
	import org.thot.model.ge.GameEvent;
	/**
	 * ...
	 * @author Thot
	 */
	public class ScriptAPI
	{
		
		static public var globalVars:Dictionary = new Dictionary();
		
		
		public function ScriptAPI() {}
	
		
		static public function setGlobalVar( p_varname:String, p_value:* ):void
		{
			globalVars[ p_varname ] = p_value;
		}
		
		static public function getGlobalVar( p_varname:String ):*
		{
			return globalVars[ p_varname ];
		}
		
		static public function updateProgressBar( p_progress:int ):void
		{
			var l_root:Sprite = globalVars["root"] as Sprite;
			
			if ( l_root != null )
			{
				l_root.graphics.clear();
				l_root.graphics.beginFill(0x333333, 1);
				l_root.graphics.drawRect(0, 0, p_progress, 30 );
				l_root.graphics.endFill();
			}
			
		}
		
		static public function log( p_text:String ):void
		{
			var l_root:Main = globalVars["root"] as Main;
			
			if ( l_root != null )
			{
				l_root.addText( p_text );
			}
		}
		
	}

}